package com.weatherquery.weatherapi;

import java.util.HashMap;
import java.util.Map;

/**
 * @Author Natural-Pride
 * @Date 2023/12/17 10:10
 * @注释
 */
public class cityCodeMap {
    private final HashMap<String, String> map;
    public cityCodeMap() {
        this.map = new HashMap<>();
        this.map.put("北京市", "110100");
        this.map.put("天津市", "120100");
        this.map.put("上海市", "310100");
        this.map.put("重庆市", "500100");
        this.map.put("石家庄市", "130100");
        this.map.put("太原市", "140100");
        this.map.put("呼和浩特", "150100");
        this.map.put("沈阳市", "210100");
        this.map.put("长春市", "220100");
        this.map.put("哈尔滨市", "230100");
        this.map.put("南京市", "320100");
        this.map.put("杭州市", "330100");
        this.map.put("合肥市", "340100");
        this.map.put("福州市", "350100");
        this.map.put("南昌市", "360100");
        this.map.put("济南市", "370100");
        this.map.put("郑州市", "410100");
        this.map.put("武汉市", "420100");
        this.map.put("长沙市", "430100");
        this.map.put("广州市", "440100");
        this.map.put("南宁市", "450100");
        this.map.put("海口市", "460100");
        this.map.put("成都市", "510100");
        this.map.put("贵阳市", "520100");
        this.map.put("昆明市", "530100");
        this.map.put("拉萨市", "540100");
        this.map.put("西安市", "610100");
        this.map.put("兰州市", "620100");
        this.map.put("西宁市", "630100");
        this.map.put("银川市", "640100");
        this.map.put("乌鲁木齐市", "650100");
        this.map.put("香港特别行政区", "810000");
        this.map.put("澳门特别行政区", "820001");
        this.map.put("台北市", "710113");
    }

    public String[] getAllCityCodes() {
        String[] result = new String[ this.map.size() ];  // 创建一个存放城市代码的数组
        int i = 0;  // 计数器
        for ( Map.Entry<String, String> entry : this.map.entrySet() ) {
            result[i++] = entry.getValue();  // 将数组元素设置为城市代码
        }
        return result;  // 返回所有城市代码的数组
    }

}
